<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="StudentDTO.UserInfoDTO "%>
<html>
<head>
    <meta charset="UTF-8">
    <style>
        a{
            margin:10px;
        }
        #table1{
            width:50%;
            border-collapse: collapse;
            text-align: left;
        }
        #table1 th,td{
            border:1px solid orange;
            padding: 7px;
        }
        #table1 th{
            background-color: orange;
            color: white;
        }
    </style>
    <title>首页</title>
</head>
<body>
<%
    String submitStr;
    UserInfoDTO uid;
    if(session.getAttribute("UserInfor")!=null) {
        uid=(UserInfoDTO) session.getAttribute("UserInfor");
        submitStr="退出";
    }
    else {
        uid=null;
        submitStr = "登录";
    }

%>
    <form action="http://localhost:8080/login/dgut" method="GET">
        <%
            if(uid!=null){
                response.getWriter().write("<table border=1 align=center id='table1'>");
                response.getWriter().write("<caption style='background-color:grey;'>学生个人信息表</caption>");
                response.getWriter().write("<tr><th></th><th></th></tr>");
                response.getWriter().write("<tr><td>账号:</td><td>"+uid.getUsername()+"</td></tr>");
                response.getWriter().write("<tr><td>姓名:</td><td>"+uid.getName()+"</td></tr>");
                response.getWriter().write("<tr><td>类型:</td><td>"+uid.getGroup()+"</td></tr>");
                response.getWriter().write("<tr><td>学院:</td><td>"+uid.getFaculty_title()+"</td></tr>");
                response.getWriter().write("</table>");
            }
        %>
        <table border=1 align=center id='table1'>
            <tr><td>操作:</td><td><input type="submit" name="submit" value=<%=submitStr%>></td></tr>
        </table>
    </form>
</body>
</html>
